package com.chixing.day05;

public class TestProduct {

    public static void main(String[] args) {
        Product[] pro = new Product[10];
int i=0;
        pro[0] = new Product("手机0", 99, "中国", "001");
        pro[1] = new Product("手机1", 199, "中国", "0012");
        pro[2] = new Product("手机2", 299, "中国", "0013");
        pro[3] = new Product("手机3", 399, "中国", "0014");
        pro[4] = new Product("手机4", 499, "中国", "0015");
        pro[5] = new Product("手机5", 599, "中国", "0016");
        pro[6] = new Product("手机6", 49, "中国", "0017");
        pro[7] = new Product("手机7", 799, "中国", "0018");
        pro[8] = new Product("手机8", 9, "中国", "0019");
        pro[9] = new Product("手机9", 999, "中国", "0010");

        for(i=0;i<10;i++){
            System.out.println(pro[i].getProId()+pro[i].getProName());
        }
        for(i=0;i<10;i++){
            if(pro[i].getProPrice()>300) {
                System.out.println(pro[i].getProName());
            }
        }
        for ( i = 0; i < pro.length -1;i++) {
            for (int j = 0; j < pro.length - i - 1; j++) {
                if (pro[j].getProPrice() > pro[j + 1].getProPrice()) {
                    Product temp = pro[j];
                    pro[j] = pro[j + 1];
                    pro[j + 1] = temp;
                    System.out.println(pro[j].getProId()+pro[j].getProName());
                }

            }

        }



    }
}
